package com.baocai.tools.controller;

import com.baocai.tools.domain.MyException;
import com.baocai.tools.domain.User;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.Date;

/**
 * @author ：minyang
 * @date ：Created in 2019/7/18 7:45
 * 自定义异常
 */
@Controller
@RequestMapping(value = "excption")
public class ExcptionController {

    /**
     * 功能描述：模拟全局异常
     *
     * @return
     */
    @RequestMapping(value = "/test_ext")
    public Object index() {
        int i = 1 / 0;
        return new User(11, "sfsfds", "1000000", new Date());
    }


    /**
     * 功能描述：模拟自定义异常
     *
     * @return
     */
    @RequestMapping("/myext")
    public Object myexc() {

        throw new MyException("499", "my ext异常");

    }
}
